# coding: utf-8
'''
Created on May 23rd, 2011

@author: manux
'''

import unittest
from dao.DaoElement import DaoElement

class TestAsura(unittest.TestCase):
    def setUp(self):
        self.daoElement = DaoElement('Mage', 'Mort-Vivant')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Personnage')
        self.assertEqual(self.daoElement.type, 'Mort-Vivant')
        self.assertEqual(self.daoElement.hauteur, 0)
        self.assertEqual(self.daoElement.constitution, 9)
        self.assertEqual(self.daoElement.taille, 1.7)
        self.assertEqual(self.daoElement.degats, 4)
        self.assertEqual(self.daoElement.franchissable, False)
        self.assertEqual(self.daoElement.joueur, 2)
        self.assertEqual(self.daoElement.endurance, 6)
        self.assertEqual(self.daoElement.intelligence, 5)
        self.assertEqual(self.daoElement.energie, 80)
        self.assertEqual(self.daoElement.cible, '')
    
    def test_competences(self):
        self.assertTrue(self.daoElement.competence.has_key('Shadow Bolt'))
        self.assertTrue(self.daoElement.competence.has_key('Ressucite'))
        self.assertEqual(self.daoElement.competence['Shadow Bolt'], 1)
        self.assertEqual(self.daoElement.competence['Ressucite'], 1)


class TestMantas(unittest.TestCase):
    def setUp(self):
        self.daoElement = DaoElement('DeathKnight', 'BloodElfe')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Personnage')
        self.assertEqual(self.daoElement.type, 'Vivant')
        self.assertEqual(self.daoElement.hauteur, 0)
        self.assertEqual(self.daoElement.constitution, 8)
        self.assertEqual(self.daoElement.taille, 1.6)
        self.assertEqual(self.daoElement.degats, 4)
        self.assertEqual(self.daoElement.franchissable, False)
        self.assertEqual(self.daoElement.joueur, 2)
        self.assertEqual(self.daoElement.endurance, 7)
        self.assertEqual(self.daoElement.intelligence, 7)
        self.assertEqual(self.daoElement.energie, 120)
        self.assertEqual(self.daoElement.cible, '')
    
    def test_competences(self):
        self.assertTrue(self.daoElement.competence.has_key('Frappe'))
        self.assertTrue(self.daoElement.competence.has_key('Seduction'))
        self.assertEqual(self.daoElement.competence['Frappe'], 1)
        self.assertEqual(self.daoElement.competence['Seduction'], 1)


class TestRankor(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Guerrier', 'Nain')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Personnage')
        self.assertEqual(self.daoElement.type, 'Vivant')
        self.assertEqual(self.daoElement.hauteur, 0)
        self.assertEqual(self.daoElement.constitution, 8)
        self.assertEqual(self.daoElement.taille, 1.2)
        self.assertEqual(self.daoElement.degats, 5)
        self.assertEqual(self.daoElement.franchissable, False)
        self.assertEqual(self.daoElement.joueur, 1)
        self.assertEqual(self.daoElement.endurance, 7)
        self.assertEqual(self.daoElement.intelligence, 7)
        self.assertEqual(self.daoElement.energie, 100)
        self.assertEqual(self.daoElement.cible, '')
    
    def test_competences(self):
        self.assertTrue(self.daoElement.competence.has_key('Frappe'))
        self.assertTrue(self.daoElement.competence.has_key('Brise Genoux'))
        self.assertEqual(self.daoElement.competence['Frappe'], 1)
        self.assertEqual(self.daoElement.competence['Brise Genoux'], 1)


class TestShu(unittest.TestCase):
    def setUp(self):
        self.daoElement = DaoElement('Archer', 'Elfe')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Personnage')
        self.assertEqual(self.daoElement.type, 'Vivant')
        self.assertEqual(self.daoElement.hauteur, 0)
        self.assertEqual(self.daoElement.constitution, 5)
        self.assertEqual(self.daoElement.taille, 2.0)
        self.assertEqual(self.daoElement.degats, 3)
        self.assertEqual(self.daoElement.franchissable, False)
        self.assertEqual(self.daoElement.joueur, 1)
        self.assertEqual(self.daoElement.endurance, 9)
        self.assertEqual(self.daoElement.intelligence, 10)
        self.assertEqual(self.daoElement.energie, 120)
        self.assertEqual(self.daoElement.cible, '')
    
    def test_competences(self):
        self.assertTrue(self.daoElement.competence.has_key('Tir'))
        self.assertTrue(self.daoElement.competence.has_key('Soigne'))
        self.assertEqual(self.daoElement.competence['Tir'], 1)
        self.assertEqual(self.daoElement.competence['Soigne'], 1)


class TestArbre(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Arbre')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Arbre')
        self.assertEqual(self.daoElement.franchissable, False)
    

class TestEau(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Eau')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Eau')
        self.assertEqual(self.daoElement.franchissable, False)
    
class TestGlace(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Glace')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Glace')
        self.assertEqual(self.daoElement.franchissable, False)
    

class TestHerbe(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Herbe')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Herbe')
        self.assertEqual(self.daoElement.franchissable, True)
    
class TestNeige(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Neige')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Neige')
        self.assertEqual(self.daoElement.franchissable, True)
    
class TestRocher(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Rocher')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Rocher')
        self.assertEqual(self.daoElement.franchissable, False)
    
class TestSable(unittest.TestCase):
    
    def setUp(self):
        self.daoElement = DaoElement('Terrain', 'Sable')

    def tearDown(self):
        del self.daoElement
    
    def test_chemin(self):
        self.assertEqual(self.daoElement._chemin.split('/')[-3:-1],\
                         ['TheShinProject', 'DAO'])
    
    def test_objet(self):
        self.assertEqual(self.daoElement.objet, 'Element')
        self.assertEqual(self.daoElement.type, 'Sable')
        self.assertEqual(self.daoElement.franchissable, True)


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()

